package com.peng.pojo;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

@Table(name = "tb_level", schema = "springboot-tuofu", catalog = "")
public class Level implements Serializable {
    private int id;
    private String name;
    private double discount;
    private int consumptionCoins;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "discount")
    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    @Basic
    @Column(name = "consumption_coins")
    public int getConsumptionCoins() {
        return consumptionCoins;
    }

    public void setConsumptionCoins(int consumptionCoins) {
        this.consumptionCoins = consumptionCoins;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Level level = (Level) o;
        return id == level.id &&
                Double.compare(level.discount, discount) == 0 &&
                consumptionCoins == level.consumptionCoins &&
                Objects.equals(name, level.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, discount, consumptionCoins);
    }
}
